package com.zmytest.many2many;

import com.zmytest.BaseModel;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Entity;
import javax.persistence.ManyToMany;
import java.util.List;

/**
 * Created on 2018/12/24.
 *
 * @author zhangmingyu
 */
@EqualsAndHashCode(callSuper = false)
@Data
@Entity
public class Permission extends BaseModel<Integer> {

    private String name;

    @ManyToMany(mappedBy = "permissions")
    private List<Role> roles;

    public Permission(){}

    public Permission(String name){
        this.name = name;
    }
}
